package com.ruoyi.pidaijiData.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.pidaijiData.domain.plat.DataPidaijiDmbhzyl;
import com.ruoyi.pidaijiData.mapper.DataPidaijiDmbhzylMapper;
import com.ruoyi.pidaijiData.service.IDataPidaijiDmbhzylService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.Future;


/**
 * 皮带机堆煤保护作用力测试项Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-12
 */
@Service
public class DataPidaijiDmbhzylServiceImpl implements IDataPidaijiDmbhzylService
{
    @Autowired
    private DataPidaijiDmbhzylMapper dataPidaijiDmbhzylMapper;

    /**
     * 查询皮带机堆煤保护作用力测试项
     * 
     * @param dmId 皮带机堆煤保护作用力测试项主键
     * @return 皮带机堆煤保护作用力测试项
     */
    @Override
    public DataPidaijiDmbhzyl selectDataPidaijiDmbhzylByDmId(Long dmId)
    {
        return dataPidaijiDmbhzylMapper.selectDataPidaijiDmbhzylByDmId(dmId);
    }

    /**
     * 查询皮带机堆煤保护作用力测试项列表
     * 
     * @param dataPidaijiDmbhzyl 皮带机堆煤保护作用力测试项
     * @return 皮带机堆煤保护作用力测试项
     */
    @Override
    public List<DataPidaijiDmbhzyl> selectDataPidaijiDmbhzylList(DataPidaijiDmbhzyl dataPidaijiDmbhzyl)
    {
        return dataPidaijiDmbhzylMapper.selectDataPidaijiDmbhzylList(dataPidaijiDmbhzyl);
    }

    /**
     * 查询皮带机堆煤保护作用力测试数据
     *
     * @param dataTaskId
     * @return 皮带机能耗测试数据
     */
    @Async("threadPoolKy")
    @Override
    public Future<List<DataPidaijiDmbhzyl>> selectDataPidaijiDmbhzylByDataTaskId(Long dataTaskId) {
        List<DataPidaijiDmbhzyl> dataPidaijiDmbhzylList = dataPidaijiDmbhzylMapper.selectDataPidaijiDmbhzylByDataTaskId(dataTaskId);
        return new AsyncResult<>(dataPidaijiDmbhzylList);
    }

    /**
     * 新增皮带机堆煤保护作用力测试数据
     *
     * @param dataPidaijiDmbhzyls 皮带机能耗测试数据
     * @return 结果
     */
    @Override
    public int batchDataPidaijiDmbhzyl(List<DataPidaijiDmbhzyl> dataPidaijiDmbhzyls) {
        return dataPidaijiDmbhzylMapper.batchDataPidaijiDmbhzyl(dataPidaijiDmbhzyls);
    }

    /**
     * 修改皮带机堆煤保护作用力测试数据
     *
     * @param dataTaskId
     * @return 结果
     */
    @Override
    public int updateDataPidaijiDmbhzylByDataTaskId(Long dataTaskId) {
        return dataPidaijiDmbhzylMapper.updateDataPidaijiDmbhzylByDataTaskId(dataTaskId);
    }

    /**
     * 修改皮带机堆煤保护作用力测试数据
     *
     * @param dmId
     * @return 结果
     */
    @Override
    public int updateDataPidaijiDmbhzylByDmId(Long dmId) {
        return dataPidaijiDmbhzylMapper.updateDataPidaijiDmbhzylByDmId(dmId);
    }

    /**
     * 新增皮带机堆煤保护作用力测试项
     * 
     * @param dataPidaijiDmbhzyl 皮带机堆煤保护作用力测试项
     * @return 结果
     */
    @Override
    public int insertDataPidaijiDmbhzyl(DataPidaijiDmbhzyl dataPidaijiDmbhzyl)
    {
        dataPidaijiDmbhzyl.setCreateTime(DateUtils.getNowDate());
        return dataPidaijiDmbhzylMapper.insertDataPidaijiDmbhzyl(dataPidaijiDmbhzyl);
    }

    /**
     * 修改皮带机堆煤保护作用力测试项
     * 
     * @param dataPidaijiDmbhzyl 皮带机堆煤保护作用力测试项
     * @return 结果
     */
    @Override
    public int updateDataPidaijiDmbhzyl(DataPidaijiDmbhzyl dataPidaijiDmbhzyl)
    {
        dataPidaijiDmbhzyl.setUpdateTime(DateUtils.getNowDate());
        return dataPidaijiDmbhzylMapper.updateDataPidaijiDmbhzyl(dataPidaijiDmbhzyl);
    }

    /**
     * 批量删除皮带机堆煤保护作用力测试项
     * 
     * @param dmIds 需要删除的皮带机堆煤保护作用力测试项主键
     * @return 结果
     */
    @Override
    public int deleteDataPidaijiDmbhzylByDmIds(Long[] dmIds)
    {
        return dataPidaijiDmbhzylMapper.deleteDataPidaijiDmbhzylByDmIds(dmIds);
    }

    /**
     * 删除皮带机堆煤保护作用力测试项信息
     * 
     * @param dmId 皮带机堆煤保护作用力测试项主键
     * @return 结果
     */
    @Override
    public int deleteDataPidaijiDmbhzylByDmId(Long dmId)
    {
        return dataPidaijiDmbhzylMapper.deleteDataPidaijiDmbhzylByDmId(dmId);
    }
}
